package com.jeff.android.lab.architecture.rxjava2;

import com.jeff.android.lab.BaseRecyclerViewFragment;
import com.jeff.android.lab.architecture.rxjava2.api.RxJava2ApiFragment;
import com.jeff.android.lab.architecture.rxjava2.lifecycle.RxJava2LifeCycleFragment;
import com.jeff.android.lab.architecture.rxjava2.rxbus.RxBusFragment;
import com.jeff.android.lab.util.RouterUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: duff
 * @date: 2019/1/24
 * @since: 1.0.0
 */
public class RxJava2Fragment extends BaseRecyclerViewFragment {

    @Override
    protected List<String> getData() {
        return new ArrayList<String>() {
            {
                add("api");
                add("lifecycle");
                add("rxbus"); // rxbus
            }
        };
    }

    @Override
    protected void launch(String widget) {
        if ("api".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), RxJava2ApiFragment.class);
        } else if ("lifecycle".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), RxJava2LifeCycleFragment.class);
        } else if ("rxbus".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), RxBusFragment.class);
        }
    }

}
